/*
* CSET 3600
* Spring Semester 2013
* Melissa Brown
* Josh Siebenaler
* Matt Rich
* Christian Angelo
*
*/
package mancala;

public class HomeScreenGUI extends javax.swing.JFrame {
    
    private static boolean Status;

    /** Creates new form NewJFrame */
    public HomeScreenGUI() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jComboBox1 = new javax.swing.JComboBox();
        exit = new javax.swing.JButton();
        instruction = new javax.swing.JButton();
        modeselect = new javax.swing.JComboBox();
        startbutton = new javax.swing.JButton();
        label1 = new java.awt.Label();
        PlayerSelection = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        setTitle("homescreen");
        setName("homescreen"); // NOI18N
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        exit.setFont(new java.awt.Font("Times New Roman", 0, 12));
        exit.setText("Exit");
        exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitActionPerformed(evt);
            }
        });
        getContentPane().add(exit, new org.netbeans.lib.awtextra.AbsoluteConstraints(268, 141, -1, -1));

        instruction.setFont(new java.awt.Font("Times New Roman", 0, 12));
        instruction.setText("Instructions");
        instruction.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                instructionActionPerformed(evt);
            }
        });
        getContentPane().add(instruction, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 88, -1, -1));

        modeselect.setBackground(new java.awt.Color(204, 204, 204));
        modeselect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(Difficulty)", "Easy Mode", "Hard Mode" }));
        modeselect.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                modeselectActionPerformed(evt);
            }
        });
        getContentPane().add(modeselect, new org.netbeans.lib.awtextra.AbsoluteConstraints(111, 89, 182, -1));

        startbutton.setFont(new java.awt.Font("Times New Roman", 0, 12));
        startbutton.setText("Start Game");
        startbutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startbuttonActionPerformed(evt);
            }
        });
        getContentPane().add(startbutton, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 54, -1, -1));

        label1.setAlignment(java.awt.Label.CENTER);
        label1.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        label1.setText("Mancala");
        getContentPane().add(label1, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 10, 150, 33));

        PlayerSelection.setBackground(new java.awt.Color(204, 204, 204));
        PlayerSelection.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(Vs. Mode)", "Player Vs. Player", "Player Vs. Computer" }));
        PlayerSelection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PlayerSelectionActionPerformed(evt);
            }
        });
        getContentPane().add(PlayerSelection, new org.netbeans.lib.awtextra.AbsoluteConstraints(111, 55, -1, -1));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mancala/Wood-Plank-PVC-Floor-Tile-7004-.jpg"))); // NOI18N
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 330, 180));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void instructionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_instructionActionPerformed
        
        new InstructionGUI().setVisible(true);
        // TODO add your handling code here:
        
    }//GEN-LAST:event_instructionActionPerformed

    private void startbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startbuttonActionPerformed
        
        new MancalaGameBoardGUI().setVisible(true);
         setVisible(false);
      
    }//GEN-LAST:event_startbuttonActionPerformed

    private void exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitActionPerformed
        System.exit(0);
        // TODO add your handling code here:
    }//GEN-LAST:event_exitActionPerformed

    private void modeselectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modeselectActionPerformed
        
         
   int selection = modeselect.getSelectedIndex();
 
   if (selection == 1){
        
        MancalaGameBoardGUI.Diff = "Easy";
        
    }
   
   if(selection == 2){
       
       MancalaGameBoardGUI.Diff = "Hard";
   }
   
        
        // TODO add your handling code here:
    }//GEN-LAST:event_modeselectActionPerformed

    private void PlayerSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PlayerSelectionActionPerformed

        int selection = PlayerSelection.getSelectedIndex();
        String [] twoplayer = new String [1];
        
        if (selection == 1) {
            
             twoplayer = PlayerSettings.TwoPlayers();
             System.out.println(twoplayer[0]);
             MancalaGameBoardGUI.Versus = twoplayer[0];
             MancalaGameBoardGUI.computer = false;
             modeselect.setEnabled(false);
        }
        
        else if (selection == 2) {
            
             twoplayer = PlayerSettings.Computer();
             System.out.println(twoplayer[0]);
              MancalaGameBoardGUI.Versus = twoplayer[0];
             MancalaGameBoardGUI.computer = true;
             modeselect.setEnabled(true);
        }
        
        // TODO add your handling code here:
    }//GEN-LAST:event_PlayerSelectionActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
        
        modeselect.setEnabled(false);
    }//GEN-LAST:event_formWindowOpened

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                Status = true;
                new HomeScreenGUI().setVisible(Status);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox PlayerSelection;
    private javax.swing.JButton exit;
    private javax.swing.JButton instruction;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private java.awt.Label label1;
    private javax.swing.JComboBox modeselect;
    private javax.swing.JButton startbutton;
    // End of variables declaration//GEN-END:variables

}
